import { getRootWindow } from '@src/util/dom';
export const useStateSystemFormBuilderCell = () => {
  function getSystemFormBuilderCell() {
    const rootWindow = getRootWindow(window);
    if(!rootWindow?.getAllFormBuilderCell) {
      console.warn('getAllFormBuilderCell is not defined');
      return 1;
    }
    return rootWindow?.getAllFormBuilderCell() || 1;
  }
  return {
    getSystemFormBuilderCell,
  };
};


export const useStateSystemFormViewCell = () => {
  function getSystemFormViewCell() {
    const rootWindow = getRootWindow(window);
    if(!rootWindow?.getAllFormViewCell) {
      console.warn('getAllFormViewCell is not defined');
      return 2;
    }
    return rootWindow?.getAllFormViewCell() || 1;
  }
  return {
    getSystemFormViewCell,
  };
}

export const useStateSystemViewLayout = () => {
  function getSystemViewLayout() {
    const rootWindow = getRootWindow(window);
    if(!rootWindow?.getAllViewLayout) {
      console.warn('getSystemViewLayout is not defined');
      return 2;
    }
    return rootWindow?.getAllViewLayout() || 2;
  }
  return {
    getSystemViewLayout,
  };
}
